package com.blq.web.runner;

import com.blq.api.service.ApiService;
import com.blq.web.CustomerRepair.service.ICustomerRepairService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 工单处理启动类
 *
 * @author zeh
 */
@Slf4j
@RequiredArgsConstructor
@Component
public class WorkOrderApplicationRunner implements ApplicationRunner {

    private final ICustomerRepairService customerRepairService;

    private final ApiService apiService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        customerRepairService.timeoutToOrderPool();
        log.info("创建《定时处理超时未接单工单》线程完成");
        apiService.automaticDispatch();
        log.info("创建《定时处理工单池超时工单》线程完成");
        customerRepairService.toPayoffOrder();
        log.info("创建《定时处理订单结算》线程完成");
        customerRepairService.orderPayment();
        log.info("创建《定时处理订单打款》线程完成");
    }

}
